﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace ExtractXml
{
    class ExtractXml
    {
        static void Main(string[] args)
        {
            string text="<name><first>Ivo</first></name><age>29</age>";
            string pattern = @"\<(?<tag>\w*)\>\w*\</(?<-tag>)";
            Regex expres = new Regex(pattern);
            //Match match = Regex.Match(text, pattern); 
            Match match = expres.Match(text);
            while (match.Success)
            {
                Console.WriteLine(match.Value);
                //match = match.NextMatch();
            }

        }
    }
}
